home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1994 August: Tool Chest / Dev.CD Aug 94.toast / New System Software Extensions / OpenDoc A6 / OpenDoc Parts Framework / OPF / OS / FWGraphx / Include / FWRecShp.h < prev    next >
Encoding:
Text File  |  1994-04-21  |  3.7 KB  |  129 lines  |  [TEXT/MPS ]

  1. //========================================================================================
  2. //
  3. //    File:                FWRecShp.h
  4. //    Release Version:    $ 1.0d1 $
  5. //
  6. //    Creation Date:        3/28/94
  7. //
  8. //    Copyright:    © 1993, 1994 by Apple Computer, Inc., all rights reserved.
  9. //
  10. //========================================================================================
  11.  
  12. #ifndef FWRECSHP_H
  13. #define FWRECSHP_H
  14.  
  15. #ifndef FWSHAPE_H
  16. #include "FWShape.h"
  17. #endif
  18.  
  19. #ifndef FWBNDSHP_H
  20. #include "FWBndShp.h"
  21. #endif
  22.  
  23. //==============================================================================
  24. //    •• Forward Declarations
  25. //==============================================================================
  26.  
  27. class FW_CGraphicContext;
  28. class FW_CRectShapeRep;
  29. class FW_COvalShape;
  30. class FW_CRoundRectShape;
  31. class FW_CArcShape;
  32. class FW_CLineShape;
  33. class FW_CRegionShape;
  34.  
  35. //========================================================================================
  36. //    •• CLASS FW_CRectShape
  37. //========================================================================================
  38.  
  39. class FW_CRectShape : public FW_CShape
  40. {
  41. //----------------------------------------------------------------------------------------
  42. //    • Constructors
  43. //
  44. public:
  45.     FW_CRectShape();
  46.     FW_CRectShape(const FW_CRect& rect);
  47.     
  48.     FW_CRectShape(const FW_CRectShape& other);
  49.     FW_CRectShape(FW_CRectShapeRep* rep);
  50.             
  51. //----------------------------------------------------------------------------------------
  52. //    • Operators
  53. //
  54. public:
  55.     FW_CRectShape& operator=(const FW_CRectShape& other);
  56.     FW_CRectShape& operator=(FW_CRectShapeRep* other);
  57.     
  58.     FW_CRectShapeRep* operator->() const
  59.                 {return (FW_CRectShapeRep*)GetRep();}
  60.  
  61. //----------------------------------------------------------------------------------------
  62. //    • Conversion
  63. //
  64. public:
  65.     operator FW_COvalShape() const;
  66.     operator FW_CRoundRectShape() const;
  67.     operator FW_CArcShape() const;
  68.     operator FW_CLineShape() const;
  69.     operator FW_CRegionShape() const;
  70.  
  71. //----------------------------------------------------------------------------------------
  72. //    • static Methods
  73. //
  74. public:
  75.     static void DrawRect(FW_CGraphicContext* graphicContext, const FW_CRect& rect);
  76.                 
  77. };
  78.  
  79. //==============================================================================
  80. //    •• class FW_CRectShapeRep
  81. //==============================================================================
  82.  
  83. class FW_CRectShapeRep : public FW_CBoundedShapeRep
  84. {
  85.     friend class FW_CRectShape;
  86.     
  87. //------------------------------------------------------------------------------
  88. //    • Constructors/Destructors
  89. //
  90. protected:
  91.     FW_CRectShapeRep();
  92.     FW_CRectShapeRep(const FW_CRect& rect);
  93.     
  94.     virtual ~FW_CRectShapeRep();
  95.     
  96. //------------------------------------------------------------------------------
  97. //    • Inherited API
  98. //
  99. public:
  100.     // ----- Hit Testing -----
  101.     virtual FW_HitTestPart HitTest(const FW_CPoint& test) const;
  102.  
  103.     // ----- Rendering -----
  104.     virtual void     Draw(FW_CGraphicContext* graphicContext);
  105.     static void     DrawRect(FW_CGraphicContext* graphicContext, const FW_CRect& rect);
  106.     
  107.     // ----- Default shape -----
  108.     virtual void     SetAsDefault() const;
  109.  
  110. //------------------------------------------------------------------------------
  111. //    • New API
  112. //
  113. public:
  114.     FW_CRectShape    Copy() const;
  115. };
  116.  
  117. //==============================================================================
  118. //    •• Inlines
  119. //==============================================================================
  120.  
  121. //------------------------------------------------------------------------------
  122. //    • FW_CRectShape::DrawRect
  123. //------------------------------------------------------------------------------
  124. inline static void FW_CRectShape::DrawRect(FW_CGraphicContext* graphicContext, const FW_CRect& rect)
  125. {
  126.     FW_CRectShapeRep::DrawRect(graphicContext, rect);
  127. }
  128.                 
  129. #endif